#ifndef GRAPHICTILE_H
#define GRAPHICTILE_H

#include <QtGui>
#include <QGraphicsRectItem>
#include <QImage>
#include <QPixmap>
#include <QColor>

/**
  * 图块显示单元
  */
class GraphicTile : public QGraphicsRectItem
{
public:
    GraphicTile(int w, int h);
    GraphicTile(QImage &img, int sx, int sy, int w, int h);
    ~GraphicTile();
    
    /** 下标，在数组中的位置 */
    int subindex;
    /** 图块的序号 */
    int index;

    int width;
    int height;

    QImage::Format format;

    QImage *tile;
    int transtype;

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
private:
    QPen pen;
    QColor cblack;
    QColor cgreen;
    QColor cred;

};

#endif // GRAPHICTILE_H
